/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package circuit1;

/**
 *
 * @author Erik
 */
import java.awt.*;

public class OscilloscopeUI implements IView{
    private Oscilloscope osc;
    private String ID;
    private int pos;
    
    /**
     * Konstruktor, ertekek beallitasa
     * @param e
     * @param n 
     */
    public OscilloscopeUI(Oscilloscope e, int n){
        //pos = n%2 == 0 ? n : n+10;
        pos = n + (n%6)*6;
        osc = e;
        ID = osc.getId();
    }
    /**
     * ID getter metodusa
     * @return 
     */
    public String getID(){
        return ID;
    }
    /**
     * pos getter metodusa
     * @return 
     */
    public int getPos(){
        return pos;
    }
    /**
     * Az elem kirajzolasa
     * @param g 
     */
    public void draw(Graphics g){
        g.drawRect(10+(pos%6)*160, 0+(pos/6)*60, 65, 40);
        g.drawString(osc.getId(), 15+(pos%6)*160, 15+(pos/6)*60);
        String value = osc.getValuesToShow();
        g.drawString(value, 15+(pos%6)*160 ,30+(pos/6)*60);
    }
    /**
     * Esemeny hozzarendelese az elemhez
     */
    public void act(){
        
    }
}
